import { post } from '@/request/http'
// import { toString } from '@/utils/utils'
import store from '@/store'

// 订单分配  接口

//订单分配 上半部分表格数据
export const orderAllotList =(data) =>
  post(
    '/FTKJWLHYPT/orderManagement/list',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            odcConsigner:data.odcConsigner, //委托人
            odcCreator:data.odcCreator, //  创建人
            odcCode:data.odcCode, // 订单号
            ordCreatetimeStart:data.ordCreatetimeStart,  //下单开始时间
            ordCreatetimeEnd:data.ordCreatetimeEnd,    //下单结束时间
            odcStatus: '分配' //
          }
        },
        Orderbys: {},
        PageIndexs: {
          FTKJWLHYPT:data.PageIndexs
        },
        PageSizes: {
          FTKJWLHYPT:data.PageSizes
        }
      }
    }
  )
  //订单分配 下半部分表格数据
export const orderAllotData =(data) =>
  post(
    '/FTKJWLHYPT/orderManagement/queryOperSerList',
    {
      ordId:data.ordId,
      ordEtpId:store.state.user.FLT_UUID_DX_H
    }
  )
  // 订单分配  供应商接单弹出框 上半部分列表接口
export const orderAllotJd =(data) =>
  post(
    '/FTKJWLHYPT/orderManagement/orderDistribution',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            odcId:data.odcId,
            opdId:data.opdId,
            ordId:data.ordId,
          }
        },
      }
    }
  )
  //订单分配 供应商接单弹出框 下半部分列表
export const orderAllotJdList =(data) =>
  post(
    '/FTKJWLHYPT/orderManagement/querySupplierList',
    {
      code:data.code,
      dptId:store.state.user.DPTID_DX_H.toString(),
      name:data.name.toString()
    }
  )
  //订单分配 供应商接单弹出框  取消供应商接单
export const orderAllotQx =(data) =>
  post(
    '/FTKJWLHYPT/orderManagement/orderCancelOperate',
    {
      optId:data.optId,
      code: store.state.user.USR_CODE_DX_H,
      ordcode: data.ordcode
    }
  )

//订单分配  托单信息补录 查询
export const orderAllotCx =(data) =>
  post(
    '/FTKJWLHYPT/orderManagement/editQueryBl',
    {
      optId:data.optId,
    }
  )
//订单分配  托单信息补录 保存
export const orderAllotBc =(data) =>
  post(
    '/FTKJWLHYPT/orderManagement/saveOperate',
    {
      optId:data.optId,  //主键ID
      optVessel:data.optVessel, //船名
      optVoyageno:data.optVoyageno, //航次
      optVoyagedate:data.optVoyagedate, //船期
      optBoxdate:data.optBoxdate, //做箱时间
      optBllno:data.optBllno,  //提单号
      optShipcompany:data.optShipcompany, //船公司名称
      optType:data.optType, //操作类型
      optOrdcode:data.optOrdcode //订单代码
    }
  )

//订单分配  托单信息补录 船公司下拉框
export const orderAllotXlList =(data) =>
  post(
    '/FTKJWLHYPT/orderManagement/getTmShiplnesModelList',
    {
      splCode:data.splCode,
      splName:data.splName
    }
  )
  //订单分配  供应商接单  费用信息 删除
export const orderAllotXldel =(data) =>
  post(
    '/FTKJWLHYPT/orderManagement/delPrice',
    {
      Data:{
        Parameters:{
          FTKJWLHYPT:{
            ptpId:data.ptpId
          }
        }
      }
    }
  )
  //订单分配  供应商接单  费用信息 保存
export const orderAllotXladd =(data) =>
  post(
    '/FTKJWLHYPT/orderManagement/saveSupplierList',
    {
      Data:{
        Parameters:{
          FTKJWLHYPT:{
            opdId:data.opdId,
            odcPdtId:data.odcPdtId,
            code:store.state.user.USR_CODE_DX_H,
            depId:store.state.user.FLT_UUID_DX_H,
            fltId:store.state.user.FLT_UUID_DX_H,
            eptId:data.eptId,
            frtOrderPrice:[
              {
                ptpId:data.ptpId,
                ptpPrice:data.ptpPrice,
                ptpOrdId:data.ptpOrdId,
                ptpCurrency:data.ptpCurrency,
                cmeaning:data.cmeaning
              }
            ]
          }
        }
      }
    }
  )
